/**
 * 
 */
package nl.wowww.top2000.client.spring;

import java.io.IOException;
import java.net.URISyntaxException;

import nl.wowww.top2000.model.Artist;
import nl.wowww.top2000.model.ws.ArtistRequest;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.ws.client.core.support.WebServiceGatewaySupport;

/**
 * @author http://www.linkedin.com/in/marcdekwant
 * @company wowww.nl
 *
 */
public class MusicClient extends WebServiceGatewaySupport {
 
    public void echo() throws IOException, URISyntaxException {
        ArtistRequest req = new ArtistRequest();
        req.setId(1);
        //Artist artist = (Artist)getWebServiceTemplate().marshalSendAndReceive(req,new ActionCallback(new URI("http://www.wowww.nl/top2000/artist/schemas/ArtistRequest"),new Addressing10(),new URI("http://www.wowww.nl/top2000/artist/schemas/ArtistResponse")));
        Artist artist = (Artist)getWebServiceTemplate().marshalSendAndReceive(req);
        System.out.println(artist.getAge());
    }
    
    public static void main(String[] args) throws IOException, URISyntaxException {
        ApplicationContext applicationContext =
                new ClassPathXmlApplicationContext("applicationContext.xml", MusicClient.class);
        MusicClient musicClient = (MusicClient) applicationContext.getBean("musicClient");
        musicClient.echo();
    }

}
